13. System Up Time
getSysUpTime()
7# Example - Class ProcessParser - GetSysUpTime(Provide The Function)
System Up Time
Read data from /proc
. stoi()
converts a string
to an int
.
long int ProcessParser::getSysUpTime()
{
string line;
ifstream stream = Util::getStream((Path::basePath() + Path::upTimePath()));
getline(stream,line);
istringstream buf(line);
istream_iterator<string> beg(buf), end;
vector<string> values(beg, end);
return stoi(values[0]);
}